package com.designpatternspart2.structuraldesignpatterns.bridgepattern;

/**
 *
 * @author Lance
 */
public abstract class Vehicle
{

    private Engine engine;
    private int weightInKilos;

    public abstract void drive();

    public void setEngine(Engine engine)
    {
        this.engine = engine;
    }

    public void reportOnSpeed(int horsepower)
    {
        int ratio = getWeightInKilos() / horsepower;
        if (ratio < 3)
        {
            System.out.println("The vehicle is going at a fast speed");
        }
        else if ((ratio >= 3) && (ratio < 8))
        {
            System.out.println("The vehicle is going an average speed");
        }
        else
        {
            System.out.println("The vehicle is going at a slow speed");
        }
    }

    public Engine getEngine()
    {
        return engine;
    }

    public int getWeightInKilos()
    {
        return weightInKilos;
    }

    public void setWeightInKilos(int weightInKilos)
    {
        this.weightInKilos = weightInKilos;
    }
}
